home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1994 November / macformat-018.iso / Utility Spectacular / Developer / f2c_5_92 Folder / f2c_5_92 / bpdxtras.c next >
Encoding:
C/C++ Source or Header  |  1992-01-09  |  1.5 KB  |  82 lines  |  [TEXT/KAHL]

  1. /* This is a short set of the routines that were required to get the f2c programs to */
  2. /* link with the libF77 and libI77 libraries Basil P. Duval, 9 Jan 1991              */
  3.  
  4. #include "stdio.h"        /* test program for the xtra routines below */
  5.  
  6.  
  7. #ifndef THINK_C            /* this is just used to ignore the test program */
  8.  
  9. char *mktemp();
  10. int    access();
  11. void pause();
  12. int    getpid();
  13. double erf();
  14. double erfc();
  15.  
  16. main ()
  17. {
  18. char buf[20],*p1;
  19. int    itemp;
  20. double dtemp;
  21. real rtemp=3.14;
  22.         (void) strcpy(buf,"tmp.FXXXXXX");
  23.         p1= mktemp(buf);
  24.         itemp=access("bpdxtras.c",0);
  25.         pause();
  26.         itemp=getpid();
  27.         dtemp=erf(&rtemp);
  28.         double erfc(&rtemp);
  29. }
  30.  
  31. #endif                /* for testing, the def THINK_C can be reversed */
  32.  
  33. static int tempcnt=0;
  34.  
  35. char *mktemp (char *nm)
  36. /* to replace last 6 X characters with an individual number */
  37. {
  38. char *cpnt;            /*char pointer for name handling */
  39.  
  40. tempcnt+=1;            /* increment counter to make name unique */
  41. cpnt=nm+strlen(nm)-6;
  42.  
  43. sprintf(cpnt,"%i",tempcnt);
  44. return nm;
  45. }
  46.  
  47. int access(char *Name, int dummy)
  48. /* return 0 if Name exists otherwise 1 */
  49. {
  50. FILE *fn;
  51.  
  52. fn=fopen(Name,"r");        /* open the named file for reading */
  53. if(fn==NULL) return 1;    /* null indicates file did not exist */
  54. fclose(fn);                /* close up the buffer */
  55. return 0;                /* yes the file did exist */
  56. }
  57.  
  58. void    pause()
  59. /* routine waits for a character to be input */
  60. {
  61. }
  62.  
  63. int    getpid()
  64. /* routine supposed to get a PID */
  65. {
  66.     return 0;
  67. }
  68.  
  69. double erf(x)
  70. float *x;
  71. /* routine does something */
  72. {
  73.     return (double)*x;
  74. }
  75.  
  76. double erfc(x)
  77. float *x;
  78. /* routine does something */
  79. {
  80.     return (double)*x;
  81. }
  82.